import { ActivityIndicator } from 'antd-mobile';
import { Component } from 'react';
import styles from './index.less';
export default function(Comp) {
  // const childrenWithProps = React.Children.map(props.children,
  //   (child) => React.cloneElement(child, restProps));
  return class extends Component {
    render() {
      let { loading, ...restProps } = this.props;
      console.log('​loading', loading);
      return (
        <div>
          {/* {!loading && childrenWithProps} */}
          <div className={loading ? styles.hidden : 'test'}>
            <Comp {...restProps} />
          </div>
          <ActivityIndicator toast text="正在加载" animating={loading} />
        </div>
      );
    }
  };
}
